<?php
namespace app\web\controller;
use app\web\model\ScorecModel;

use app\common\controller\StoreBaseController;
use think\Db;

class ScorecController extends StoreBaseController
{
 	protected $model;
 	protected $paymodel;
	
    protected function _initialize() {
        parent::_initialize();
        $this->model = new ScorecModel();
         $this->paymodel = new ScorecModel();
        
    }
    public function index( $page = 1){
        //商家积分
        $scoresum = session('storeInfo')['score'];
        $this->assign('scoresum',$scoresum);
        //商家余额
        $moneysum = session('storeInfo')['store_balance'];
        $this->assign('moneysum',$moneysum);
		$store_id=session('storeInfo')['id'];
		$sql="select sum('newbonusflg') as s1, sum('newblanceflg') as s2  from long_line_member where store_id=$store_id";
		$res=Db::query($sql);
		$total_score=$res?$res[0]['s1']:0;
		$total_money=$res?$res[0]['s2']:0;
		 $this->assign('total_score',$total_score);
		 $this->assign('total_money',$total_money);
        return $this->fetch('index');
    }
}